home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Gold Collection
/
Software Vault - The Gold Collection (American Databankers) (1993).ISO
/
cdr11
/
powerb5.zip
/
P5DBS000.TIP
< prev
next >
Wrap
Text File
|
1993-06-01
|
2KB
|
64 lines
When you delete records from a Paradox table, you don't
regain even one byte of disk space! Paradox never physically
deletes these records; it simply marks "deleted" records as
unused. If you add more records, Paradox will reuse the
space, but if you add fewer records than you've deleted,
you're left with a bigger file than you need. Fortunately,
there's an undocumented way to recover this wasted space.
When you restructure a table (say, to change, add, or delete
fields), Paradox rewrites and compacts it.
Because the restructuring feature doesn't check to see if
you've actually changed anything, it provides a quick and
easy way to compress a table. I wrote a PAL script named
COMPRESS.SC that squeezes the table currently being viewed
by removing the excess space left by deleted records. To run
it, bring up the file in question, then select Scripts·Play,
type COMPRESS, and press <Enter>. Your hard disk will run
for a while, then COMPRESS will beep and tell you how much
of the unused space you've regained. Note, however, that if
you want to delete all the records in a table, you should
use the EMPTY function instead of deleting all the records
and compressing. EMPTY simply re-creates the disk file with
no entries, freeing all the space that held the records.
David Babcock
San Jose, California
Editor's Note: A listing of Mr. Babcock's PAL script appears
below. It shrinks a Paradox data base by removing "deleted"
records, which still take up space.
---- BEGIN LISTING ----
; COMPRESS.SC PAL script to compress current table
; By Dave Babcock
;
; Make sure there is a current table
IF NIMAGES() = 0 THEN
MESSAGE "No table to compress!"
BEEP SLEEP 5000
QUIT
ENDIF
; Complete any pending operation and return to main mode
IF SYSMODE() <> "Main" THEN
DO_IT!
ENDIF
; Save size of current table
OldSize = FILESIZE(TABLE()+".DB")
; "Restructure" table with no changes to recover space
MENU {Modify} {Restructure} SELECT TABLE() TYPEIN TABLE()
{DO-IT!}
; Report space saved by compaction
NewSize = FILESIZE(TABLE()+".DB")
MESSAGE STRVAL(OldSize - NewSize) + " bytes saved!"
BEEP SLEEP 5000
---- END LISTING ----
Title: Reducing a Paradox
Category: DBS
Issue Date: March, 1992
Editor: Brett Glass
Supplementary Files: None
Filename: P5DBS000.TIP